package io.anyways.web;

import cn.hutool.json.JSONUtil;
import io.anyways.service.DemoService;
import io.anyways.vo.Employee;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class DemoController {

    @Autowired
    private DemoService demoService;

    @GetMapping("/test1")
    public Employee test1(@RequestParam("eId") String eId) {
        return demoService.getEmployee(eId);
    }

    @GetMapping("/test2")
    public Employee test2(@RequestParam("eId") String eId) {
        return JSONUtil.toBean(demoService.getStringRedisEmployee(eId), Employee.class);
    }
}
